const gulp = require('gulp')
const admin_target_path = 'F:/laolang2016/react-jira/pluto/pluto-admin/target/classes'

const src_gen = 'F:/laolang2016/react-jira/pluto/pluto-generator/src/main/resources/**/*'
const src_sys = 'F:/laolang2016/react-jira/pluto/pluto-system/src/main/resources/**/*'
const src_ucenter = 'F:/laolang2016/react-jira/pluto/pluto-ucenter/pluto-ucenter-server/src/main/resources/**/*'




exports.taskCopyGenRes = gulp.task('taskCopyGenRes', () => {
		console.log('copy gen resources')
    return gulp.src(src_gen)
        .pipe(gulp.dest(admin_target_path))
})

exports.taskCopySysRes = gulp.task('taskCopySysRes', () => {
		console.log('copy sys resources')
    return gulp.src(src_sys)
        .pipe(gulp.dest(admin_target_path))
})

exports.taskCopyUcenterRes = gulp.task('taskCopyUcenterRes', () => {
		console.log('copy ucenter resources')
    return gulp.src(src_ucenter)
        .pipe(gulp.dest(admin_target_path))
})

function watchFile() {
    gulp.watch(src_gen, gulp.series('taskCopyGenRes'))
    gulp.watch(src_gen, gulp.series('taskCopySysRes'))
    gulp.watch(src_gen, gulp.series('taskCopyUcenterRes'))
}

exports.taskWatch = gulp.task('taskWatch', (cb) => {
    watchFile()
    cb()
})

gulp.task('default', gulp.series(gulp.parallel('taskCopyGenRes','taskCopySysRes','taskCopyUcenterRes', 'taskWatch'), (done) => {
    watchFile()
    done()
}))